fix: adjust error handling in suspend script#314
fix: adjust error handling in suspend script#314ro8inmorgan merged 14 commits intoLoveRetro:mainfrom
Conversation
|
Included @ro8inmorgan changes from #323 so I can test them both together |
|
Ok I will close my PR and we can continue on this one |
|
Its not really clear where it runs resume() now only? |
|
The previous script would just run and then suspend and then when you wake up it would continue to run for the rest of the code where it does the resume stuff. But now I see it runs the main function which does the suspend stuff. But how is the resume function triggered? |
|
Ok no clue how it works, but it works just tested it. Its shell magic :D Both main and resume are being called. Looks also like wifi is coming back on more instant. I sleep/resumed now a couple of times and wifi came back on right away while before it could def take a while. |
|
It's triggered using the "trap "resume" EXIT INT TERM HUP QUIT". It basically means the resume function will run regardless of how the script exits (even if there's an error). |
|
Done it like this because the suspend script was sometimes failing at "echo mem >/sys/power/state" which causes the script to fail and exit. The after function then didn't run and WiFi/Bluetooth was not getting restored. |
|
There's some more info on #304 |
Opened a new PR from a branch this time. Same changes as #304, but now using trap to run the after/resume function on any error.